package com.ysd.lis.controller.eq;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.eq.EqPatrolTask;
import com.ysd.lis.request.CommonPageDto;
import com.ysd.lis.service.eq.EqPatrolTaskService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 设备巡检记录 前端控制器
 * </p>
 *
 * @author WH
 * @since 2024-08-15
 */
@RestController
@RequestMapping("/api/eq/patrolTask")
public class EqPatrolTaskController extends BaseController {

    @Autowired
    private EqPatrolTaskService eqPatrolTaskService;

    @ApiOperation("分页查询")
    @GetMapping("/findPatrolTaskPageList")
    public Result findPatrolTaskPageList(CommonPageDto pageParam) {
        return eqPatrolTaskService.findPatrolTaskPageList(pageParam);
    }

    @ApiOperation("新增巡检任务")
    @PostMapping("/addPatrolTask")
    public Result addPatrolTask(@RequestBody EqPatrolTask eqPatrolTask) {
        return eqPatrolTaskService.addPatrolTask(eqPatrolTask);
    }
    @ApiOperation("编辑巡检任务")
    @PostMapping("/editPatrolTask")
    public Result editPatrolTask(@RequestBody EqPatrolTask eqPatrolTask) {
        return eqPatrolTaskService.editPatrolTask(eqPatrolTask);
    }

    @ApiOperation("查询巡检任务")
    @GetMapping("/findPatrolTaskById")
    public Result findPatrolTaskById(EqPatrolTask eqPatrolTask) {
        return eqPatrolTaskService.findPatrolTaskById(eqPatrolTask);
    }

    @ApiOperation("查询巡检任务数据分析")
    @GetMapping("/patrolTaskAnalysis")
    public Result patrolTaskAnalysis(EqPatrolTask eqPatrolTask) {
        return eqPatrolTaskService.patrolTaskAnalysis(eqPatrolTask);
    }

    @ApiOperation("查询巡检任务通过计划id")
    @GetMapping("/findPatrolTaskByPlanId")
    public Result findPatrolTaskByPlanId(EqPatrolTask eqPatrolTask) {
        return eqPatrolTaskService.findPatrolTaskByPlanId(eqPatrolTask);
    }


    @ApiOperation("批量删除巡检任务")
    @PostMapping("/deletePatrolTask")
    public Result deletePatrolTask(@RequestBody List<EqPatrolTask> eqPatrolTaskes) {
        return eqPatrolTaskService.deletePatrolTask(eqPatrolTaskes);
    }

}
